package de.dhbw.minf12.mas;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import de.dhbw.minf12.mas.logic.SupplierLogic;

public class SupplierLogicTester {
	
	private int[][] t;
	private SupplierLogic agent;
	
	@Before
	public void setup(){
		t  = FileImporter.loadInstanceFile("input/beispiel");
		agent = new SupplierLogic(t);
	}

	@Test
	public void testDCalculation() {
		int[][] d = agent.getD();
		
		assertEquals(0, d[0][0]);
		assertEquals(4, d[0][1]);
		assertEquals(6, d[2][1]);
		
		/*for(int i = 0; i < d.length; i++){
			for(int j = 0; j < d[i].length; j++){
				System.out.println("SourceJob: " + i + ", TargetJob: " + j + ", Delay: " + d[i][j]);
			}
		}*/
	}
	
	@Test
	public void testTSum(){
		assertEquals(21, agent.getTSum());
	}
	
	@Test
	public void testSolutionValue(){
		List<Integer> data = new ArrayList<Integer>();
		data.add(0);
		data.add(2);
		data.add(1);
		
		Permutation perm = new Permutation(data);
		
		assertEquals(8, agent.calculateSolutionValue(perm));
	}

}
